function CreateXmlHttpObject()
{ 
  var objXMLHttp=null;
  if (window.XMLHttpRequest)
  {
	  objXMLHttp=new XMLHttpRequest();
  }
  else if (window.ActiveXObject)
  {
	  objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  return objXMLHttp;
}
  

function getsearchresult()
{ 	var type = document.browseform.type.value;
	var str = document.browseform.searchvalue.value;
	if(type == ''){
		document.getElementById("searchresult").innerHTML='Specify a search type';
		return;
	}
		
	$("#ajaxloader").show();
	document.getElementById("searchresult").innerHTML='';
	xmlHttp=CreateXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	} 
	
	var url = "browseBookProcess.jsp";
	url=url+"?search="+str;
	url=url+"&type="+type;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange = function(){
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	  	{	$("#ajaxloader").hide();
	  		document.getElementById("searchresult").innerHTML=xmlHttp.responseText; 
	  	} 
	}; 
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

